package otl;

import processing.core.*;

import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.geo.Location;
import de.fhpotsdam.unfolding.marker.SimplePointMarker;
//import de.fhpotsdam.unfolding.utils.MapUtils;
import de.fhpotsdam.unfolding.utils.ScreenPosition;

@SuppressWarnings("serial")
public class Place extends PApplet {

	PApplet parent; // The parent PApplet that we will render ourselves onto
	UnfoldingMap map;
	
	int	id; 		//station id
	String name;	//the name of the building
	
	float geoLong;
	float geoLat;
	PVector geoLoc; // the long/lat coordinate of the station
	String Dtype;	//the datatype -- eData or cData
	
	/*Data related*/
	Location locationPlace;
	
	/*Graphics Related*/
	SimplePointMarker markerPlace;
	
	Place(PApplet p, UnfoldingMap m,int pID, String pName, int stationID, float pLong,float pLat, String dType) {
		parent = p;
		map = m;
		id = pID;
		name = pName;
		Dtype = dType;
		
		locationPlace = new Location(pLat, pLong);
		markerPlace = new SimplePointMarker(locationPlace);
		
	}
	
	public void drawPlace(){
		ScreenPosition posSPlace = markerPlace.getScreenPosition(map);
		parent.strokeWeight(3);
		parent.stroke(255, 0, 0, 200);
		parent.strokeCap(SQUARE);
		parent.noFill();
		// Zoom dependent marker size
		// float s = map.getZoom();
		float s = 30;
		parent.arc(posSPlace.x, posSPlace.y, s, s, -PI * 0.9f, -PI * 0.1f);
		parent.arc(posSPlace.x, posSPlace.y, s, s, PI * 0.1f, PI * 0.9f);
		parent.fill(0);
		parent.text(this.name, posSPlace.x - parent.textWidth(this.name) / 2, posSPlace.y + 4);
		
	}
	
	public void setParentApplet(PApplet p){
		parent = p;
	}
}
